n = 20;alpha = 0.01;
# x = rnorm(n, mean=10.5, sd=1.3);
x = c(9.19674754344139, 9.63910759933721, 9.74262125209917, 9.43654896748158, 
      9.31804781078526, 10.8630129999211, 10.0837925649916, 12.7851504758879, 
      11.8864172344416, 10.4082407837949, 11.3053029699559, 10.5425309253279, 
      11.1705989918131, 11.9882372005504, 11.7387457116852, 11.8917544828766, 
      11.0655191951293, 9.52449768566591, 9.90604356455705, 10.5076853478802
)


hypothesisTest = t.test(x, mu=10,  alternative = "less" ,conf.level = 1-alpha);
print(hypothesisTest); # Printing of the result is useful if you execute a script file 

# criticalValue = qt(alpha,df=n-1,lower.tail=FALSE)
# xBar = mean(x)
# stdDev = sd(x)
# xBar
# c(xBar - criticalValue * stdDev / sqrt(n) , Inf)
# 
# 
# 
# tStat = ((xBar - 10) / stdDev) * sqrt(n)
# criticalValue = qt(1-alpha,df=n-1)
# tStat
# criticalValue
# 
# dist = pt(tStat, df=n-1, lower.tail = TRUE, log.p = FALSE)
# minAlpha = (1-dist)
# minAlpha